package Classes.GameUtils// ActionScript file
{
	public class GU_DataTransform
	{
		public static function csvTransformObjsAry(csvString:String,fieldLength:uint):Array
		{
			var returnAry:Array=new Array;
//			var re:RegExp=/\s+/g;
			var re:RegExp=/\r+\n+/g;
			var objString:String=csvString.replace(re,",");
			var objAry:Array=objString.split(",");
			objAry.pop();
			var fieldAttributeAry:Array=new Array;
			var i:int;
			for(i=0;i<fieldLength;i++)
			{
				fieldAttributeAry.push(objAry[i]);
			}
			for(i=fieldLength;i<objAry.length;i++)
			{
				var index:int=i/fieldLength-1;
				var location:int=i%fieldLength;
				if(!location)returnAry.push(new Object);
				returnAry[index][fieldAttributeAry[location]]=objAry[i];
			}
			return returnAry;
		}
	}
}